package com.example.wemedia.feign;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.apis.wemedia.IWemediaClient;
import com.example.model.common.dtos.ResponseResult;
import com.example.model.wemedia.pojos.WmChannel;
import com.example.wemedia.service.WmChannelService;
import com.example.wemedia.service.WmNewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class WemediaClient implements IWemediaClient {

    @Autowired
    private WmNewsService wmNewsService;

    @Autowired
    private WmChannelService wmChannelService;

    @Override
    @GetMapping("/feign/v1/wemedia/channels")
    public ResponseResult getChannels() {
        QueryWrapper<WmChannel> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByAsc("ord");
        return ResponseResult.okResult(wmChannelService.list(queryWrapper));
    }
}
